package com.xzlzx

import io.vertx.core.AbstractVerticle
import io.vertx.core.Vertx
import io.vertx.ext.web.Router
import io.vertx.ext.web.handler.StaticHandler

class VertxIndex extends AbstractVerticle {

    static void main(String[] args) {
        Vertx.vertx().deployVerticle(VertxIndex.newInstance())
    }

    @Override
    void start() throws Exception {
        def server = vertx.createHttpServer()
        def router = Router.router(vertx)
        router.route().handler(StaticHandler.create())
        server.requestHandler(router).listen(10086, { lh ->
            if (lh.succeeded()) {
                println("vertx start successful")
            } else {
                println("vertx start failed")
            }
        })
    }
}
